/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved.
 *
 */

import { Module } from '@ohos/hvigor';

import { AssembleHar } from '../tasks/hook/assemble/assemble-har.js';
import { BuildHarPreviewerRes } from '../tasks/hook/previewer/build-har-previewer-res.js';
import { PreviewBuild } from '../tasks/hook/previewer/preview-build.js';
import { UnitTestBuild } from '../tasks/unitTest/unit-test-build.js';

import { AbstractHarModulePlugin } from './common/abstract-har-module-plugin.js';

/**
 * 对外暴露har级别的接口和任务的plugin
 *
 * @since 2021/12/16
 */
export class HarPlugin extends AbstractHarModulePlugin {
  constructor(module: Module) {
    super(module);
  }

  initHarTasks(): void {
    this.assembleHar = new AssembleHar(this._moduleService!, false);
    this.buildHarPreviewerRes = new BuildHarPreviewerRes(this._moduleService!, false);
    this.previewBuild = new PreviewBuild(this._moduleService!, false);
    this.unitTestBuild = new UnitTestBuild(this._moduleService!, false);
    this._module.registry(this.assembleHar);
    this._module.registry(this.buildHarPreviewerRes);
    this._module.registry(this.previewBuild);
    this._module.registry(this.unitTestBuild);
  }
}
